<form id="attr_form" method="post" action="/manager.php?app=relation&act=item_edit">
	<div class="tabs">
		<ul>
			!{foreach from=$site_langs item=lan_name key=lan}
			<li><a href="#lan_!{$lan}">!{$lan_name}</a></li>
			!{/foreach}
		</ul>
		!{foreach from=$site_langs item=lan_name key=lan}
		<div id="lan_!{$lan}">
			<div class="form_item">
				<strong>属性名称：</strong>
				<div><input class="text_input" maxlength="50" type="text" name="!{$lan}_name" value="!{$relation_item.$lan.name}"/></div>
				<p>(属性名称应该在1至50之间)</p>
			</div>
			<div class="form_item">
				<strong>　　描述：</strong>
				<div><input class="text_input" type="text" name="!{$lan}_desc" value="!{$relation_item.$lan.desc}"/></div>
			</div>
		</div>
		!{/foreach}
	</div>
	<div class="form_item">
		<strong>　　上级：</strong>
		<div>
			<select name="parent">
				<option value="0">--顶级--</option>
				!{html_options options=$options selected=$relation_item.parent}
			</select>
		</div>
	</div>
	!{if !$relation_item}
	<div class="form_item">
		<strong>属性值：</strong>
		<div>
		<input class="text_input" type="text" name="code"/></div>
		<p>无值时，系统将自动赋值</p>
	</div>
	!{/if}
	<div class="form_item form_btn_item">
		<input type="hidden" name="id" value="!{$id}"/>
		<input type="hidden" name="rid" value="!{$relation_item._id|default:0}"/>
		<input class="button submit_btn" type=button value="保存" />
	</div>
</form>
<script>
	$(function(){
		$('#attr_form').ajax_form({
			'submit_btn' : '.submit_btn',
			'success' : function(form, data){
				var id = data.data._id;
				//删除本对话框
				$('#relation_item_edit').dialog('destroy');
				$("#relation_edit").html("正在重新载入").load('/manager.php?app=relation&act=edit&id=' + id);
			}
		});
		$("#attr_form .button").button();
		$("#attr_form .tabs").tabs();
	});
</script>